package com.common.help.test09;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Random;

import com.common.help.CareCacheInfo;

public class Test1 {

	public static Double sum(List<? extends Number> list){
		
		Double d =0D;
		for(Number n:list){
			d+=n.doubleValue();
		}
		return d;
	}
	public static void main(String[] args) {
		List<Integer> list = new ArrayList<>();
		list.add(1);
		list.add(2);
		System.out.println(sum(list));
		
		List<Double> list1 = new ArrayList<>();
		list1.add(1D);
		list1.add(2D);
		System.out.println(sum(list1));
		
		
		
		String str = "20180801";
		String s = "0730";
		String e = "2330";
		String sate = str.substring(0,4)+"-"+str.substring(4,6)+"-"+str.substring(6, 8)+" "+s.substring(0, 2)+":"+s.substring(2, 4)+":00";
		System.out.println(sate);
		
		System.out.println(sate.replace("-", ""));
		
		BigDecimal regRateDecimal = new BigDecimal(0.5111111 * 100).setScale(2, BigDecimal.ROUND_HALF_UP);
		System.out.println(regRateDecimal);
		
		Double d = 52/51D;
		//System.out.println(d);
		if (d>1){
			System.out.println(d);
		}else if(d>2){
			
		}else{
			System.out.println(d);
		}
		CareCacheInfo a = new CareCacheInfo();
		a.setPayType(null);
		if(a.getPayType()!=null && a.getPayType()==2){
			System.out.println(1111111);
			
		}
		
		String yearMonth = "2018-07";
		Calendar c = Calendar.getInstance();
		c.set(2018, 12, 0);
        System.out.println(c.get(Calendar.DAY_OF_MONTH));
        
        Calendar c1 = Calendar.getInstance();
        c1.setTime(new Date());
        c1.add(Calendar.MONTH, -1);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
        String reviewTime = sdf.format(c1.getTime());
        System.out.println(reviewTime);
        System.out.println(c1.get(Calendar.MONTH)+1);
        System.out.println("---------------------------------------------");
        List<Integer> list2 = new ArrayList<>();
        list2.add(1);
        list2.add(2);
        list2.add(3);
        list2.add(4);
        list2.add(5);
        list2.add(6);
        list2.add(7);
        list2.add(8);
        list2.add(9);
        list2.add(10);
        list2.add(4);
      
        for(int i=1;i<=list2.size()-2;i++){
			int rank = 10-list2.size()+i;
			System.out.println(rank);
		}
        System.out.println("---------------------------------------------");
        
        int chargeRateScore = 0;
        
        int chargeRate = 65;
        
        if(chargeRate >= 70 && chargeRate <= 80){//收费得分
        	chargeRateScore = 5;
        }else if(chargeRate >= 65 && chargeRate <= 70){
        	chargeRateScore = 4;
        }else if(chargeRate >= 60 && chargeRate <= 65){
        	chargeRateScore = 3;
        }else if(chargeRate >= 55 && chargeRate <= 60){
        	chargeRateScore = 2;
        }else if(chargeRate >= 50 && chargeRate <= 55){
        	chargeRateScore = 1;
        }else{
        	chargeRateScore = 0;
        }
        System.out.println(chargeRateScore);
        
        
        Random r = new Random();
        double ab = (r.nextDouble()/100+1)*50;
        System.out.println(new BigDecimal(ab));
        System.out.println(r.nextFloat()/100);
        
        Sample ss = new Sample();
        
        ss.setA(1);
        
        if(ss.getA()==null||ss.getA()==2){
        	System.out.println("zou");
        }
	}
	
	
	
}
